<template>
    <el-card class="box-card login-container">
        <div slot="header" class="login-header">
            <!-- <div style="margin:-18px -20px; padding:10px 20px;">PMS登录</div> -->
            <div class="title">PMS登录</div>
        </div>
        <div>
            <el-form :model="ruleForm2" :rules="rules2" ref="ruleForm2" label-position="left" label-width="0px" class="demo-ruleForm ">
                <el-form-item prop="account" class="account-input">
                    <el-input type="text" v-model="ruleForm2.account" prefix-icon="iconfont icon-account" auto-complete="off" placeholder="账号"></el-input>
                </el-form-item>
                <el-form-item prop="checkPass">
                    <!-- <el-input type="password" v-model="ruleForm2.checkPass" suffix-icon="iconfont icon-password" auto-complete="off" placeholder="密码"></el-input> -->
                  <el-input type="password" v-model="ruleForm2.checkPass" prefix-icon="iconfont icon-password" auto-complete="off" placeholder="密码"></el-input>

                </el-form-item>
                <el-checkbox v-model="checked" checked class="remember">记住密码</el-checkbox>
                <a href="javascript:void(0)" style="margin-left:40px" class="forget" @click="tip">忘记密码？</a>
                <el-form-item style="width:100%;">
                  <el-button  type="primary" style="width:100%;" @click.native.prevent="handleSubmit2" :loading="logining">登录</el-button>
									<el-button @click="getInfo">获取</el-button>
								</el-form-item>
            </el-form>
        </div>
    </el-card>
</template>
<script>
	import axios from 'axios'
	import mock from '../mock/mock.js'

  export default {
    data() {
      return {
        logining: false,
        ruleForm2: {
          account: 'admin',
          checkPass: '123456'
        },
        rules2: {
          account: [
            { required: true, message: '请输入账号', trigger: 'blur' },
            //{ validator: validaePass }
          ],
          checkPass: [
            { required: true, message: '请输入密码', trigger: 'blur' },
            //{ validator: validaePass2 }
          ]
        },
        checked: true
      };
    },
    methods: {
      handleSubmit2(ev) {  
        // var _this = this;
        this.$refs.ruleForm2.validate((valid) => {
          if (valid) {
            //_this.$router.replace('/table');
            this.logining = true;
            //NProgress.start();
            var loginParams = { username: this.ruleForm2.account, password: this.ruleForm2.checkPass };
            
            this.$router.push({ path: '/404' });
            // requestLogin(loginParams).then(data => {
            //   this.logining = false;
            //   //NProgress.done();
            //   let { msg, code, user } = data;
            //   if (code !== 200) {
            //     this.$message({
            //       message: msg,
            //       type: 'error'
            //     });
            //   } else {
            //     sessionStorage.setItem('user', JSON.stringify(user));
            //     this.$router.push({ path: '/table' });
            //   }
            // });
          } else {
            console.log('error submit!!');
            return false;
          }
        });
      },
      tip(){
        alert("忘记密码请联系系统管理员！！！");
			},
			getInfo(){
				axios.get('http://localhost:8080/user')
					.then(function(res){
						alert(JSON.stringify(res.data));
					}).catch(function(res){
						alert(res);
					})
			}

    }
  }
</script>

<style lang="scss" scoped>
  .login-container {
    -webkit-border-radius: 10px;
    border-radius: 10px;
    -moz-border-radius: 10px;
    background-clip: padding-box;
    margin: 10% auto;
    width: 380px;
    // padding: 35px 35px 15px 35px;
    background: #fff;
    border: 1px solid #eaeaea;
    box-shadow: 0 0 25px #cac6c6;
    
    .title {
    //   margin: 0px auto 40px auto;
    //   margin: 0;
      text-align: center;
      font-size: 30px;
      color: #fff;
      
    }
    .remember {
      margin: 0px 0px 25px 0px;
    }
  }
</style>
<style>
    .login-header{
      /* background-color: #29a88d !important; */
      background-color: #409eff !important;
      padding: 25px 35px 15px 35px !important;
    }
    .el-card__header {
      padding: 0px 0px;
    }
    .account-input{
      margin-top: 20px;
    }
    .forget{
      font-size: 14px;
      text-decoration: none;
      color:inherit;
    }
    body{
      /* background: url(../assets/bg.jpg); */
      /* background-color:antiquewhite; */
    }
  
</style>